/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ucb.ProjetoFinal.domain;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author DCBorges
 */
@Entity
@Table(name = "sdctb023_aplicacao")
public class Aplicacao implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CO_APLICACAO")
    private Integer coAplicacao;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "DE_APLICACAO")
    private String deAplicacao;
    @JoinColumn(name = "CO_PERFIL", referencedColumnName = "CO_PERFIL")
    @ManyToOne
    private Perfil coPerfil;

    public Aplicacao() {
    }

    public Aplicacao(Integer coAplicacao) {
        this.coAplicacao = coAplicacao;
    }

    public Aplicacao(Integer coAplicacao, String deAplicacao) {
        this.coAplicacao = coAplicacao;
        this.deAplicacao = deAplicacao;
    }

    public Integer getCoAplicacao() {
        return coAplicacao;
    }

    public void setCoAplicacao(Integer coAplicacao) {
        this.coAplicacao = coAplicacao;
    }

    public String getDeAplicacao() {
        return deAplicacao;
    }

    public void setDeAplicacao(String deAplicacao) {
        this.deAplicacao = deAplicacao;
    }

    public Perfil getCoPerfil() {
        return coPerfil;
    }

    public void setCoPerfil(Perfil coPerfil) {
        this.coPerfil = coPerfil;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (coAplicacao != null ? coAplicacao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Aplicacao)) {
            return false;
        }
        Aplicacao other = (Aplicacao) object;
        if ((this.coAplicacao == null && other.coAplicacao != null) || (this.coAplicacao != null && !this.coAplicacao.equals(other.coAplicacao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.ucb.ProjetoFinal.domain.Aplicacao[ coAplicacao=" + coAplicacao + " ]";
    }
}
